package com.esri.core.tasks.ags;

import com.esri.core.internal.tasks.TaskListener;
import com.esri.core.internal.tasks.ags.b.a;
import com.esri.core.internal.tasks.e;
import com.esri.core.io.UserCredentials;
import com.esri.core.map.CallbackListener;
import com.esri.core.renderer.Renderer;

/* loaded from: classes.dex */
public class GenerateRendererTask {
    private UserCredentials _credentials;
    private String _url;

    public GenerateRendererTask(String str, UserCredentials userCredentials) {
        this._url = str;
        this._credentials = userCredentials == null ? null : userCredentials.getCopy();
    }

    public GenerateRendererTask(String str) {
        this(str, null);
    }

    public Renderer execute(GenerateRendererTaskParameters generateRendererTaskParameters) throws Exception {
        return new a(generateRendererTaskParameters.getParams(), this._url, this._credentials).execute();
    }

    public void executeAsync(GenerateRendererTaskParameters generateRendererTaskParameters, CallbackListener<Renderer> callbackListener) {
        e.c.submit(new a(generateRendererTaskParameters.getParams(), this._url, this._credentials, callbackListener == null ? null : new RendererTaskCallbackListener(callbackListener)));
    }

    /* loaded from: classes.dex */
    class RendererTaskCallbackListener implements TaskListener<Renderer> {
        CallbackListener<Renderer> callback;

        RendererTaskCallbackListener(CallbackListener<Renderer> callbackListener) {
            this.callback = callbackListener;
        }

        @Override // com.esri.core.internal.tasks.TaskListener
        public void onCompletion(short s, Renderer renderer) {
            if (s == 1) {
                this.callback.onCallback(renderer);
            }
        }

        @Override // com.esri.core.internal.tasks.TaskListener
        public void onError(Throwable th) {
            this.callback.onError(th);
        }
    }
}
